/* 
 * File:   FCB.h
 * Author: Maxwell
 *
 * Created on February 28, 2011, 8:16 PM
 */

#ifndef FCB_H
#define	FCB_H

#include <stdio.h>
#include <iostream>
#include <string>
#include "Block.h"
#include "FreeList.h"

class FCB : public Block {

    public:
        /**
         * Constructor for existing File Control Block. Does not modify disk.
         * @param blockNum Block Number of FCB on disk
         * @param disk The Disk on which this Block exists
         */
        FCB(int blockNum, Disk* disk);

        /**
         * Constructor for creating a new File Control Block on Disk. Modifies
         * Disk. Sets Start and End Block Number of associated File BlockGroup
         * to -1 and Num of Bytes and blocks to be 0.
         * @param fl FreeList pointer associated with disk
         */
        FCB(FreeList* fl);

        /**
         * Default destructor
         * @return
         */
        ~FCB();

        /**
         * Accessor for Start Block Number of file
         * @return Start Block Number
         */
        int getFileStartBlockNumber();

        /**
         * Accessor for End Block Number of file
         * @return End Block Number
         */
        int getFileEndBlockNumber();

        /**
         * Accessor for Number of Block in file
         * @return Number of blocks
         */
        int getFileNumberOfBlocks();

        /**
         * Accessor for number of Bytes of data in File
         * @return Number of Bytes
         */
        int getFileSize();

        /**
         * Modifier for Start Block Number of file
         * @param val Start Block Number
         */
        void setFileStartBlockNumber(int val);

        /**
         * Modifier for End Block Number of file
         * @param val End Block Number
         */
        void setFileEndBlockNumber(int val);

        /**
         * Modifier for Number of Block in file
         * @param val Number of blocks
         */
        void setFileNumberOfBlocks(int val);

        /**
         * Modifier for number of Bytes of data in File
         * @param val Number of Bytes
         */
        void setFileSize(int val);

        ///Location of Start Block Number
        const static int FILE_START_BLOCK_NUMBER = 1;

        ///Location of End Block Number
        const static int FILE_END_BLOCK_NUMBER = 2;

        ///Location of Number of Blocks
        const static int FILE_NUMBER_OF_BLOCKS = 3;

        ///Location of Number of Bytes on File
        const static int FILE_NUMBER_OF_BYTES = 4;

    private:
        int m_fileStart;
        int m_fileEnd;
        int m_numBlocks;
        int m_numBytes;
};



#endif	/* FCB_H */

